import getopt, sys
def main():
    try:
        opts, args = getopt.getopt(sys.argv[1:], "hi:ov", ["help", "input=", "output=", "version="])
    except getopt.GetoptError:
        # print help information and exit:
        usage()
        sys.exit(2)
    inputFile = None
    output = None
    verbose = False
    for o, a in opts:
        if o in ("-h", "--help"):
            usage()
            #sys.exit()
        if o in ("-i", "--input"):
            inputFile = a            
        if o in ("-o", "--output"):
            output = a            
        if o == "-v":
            verbose = True
            usage()
            sys.exit()
        if o == "--version":
            verbose = True
            showVersion()
            sys.exit()
    # ...
    
    print "-inputFile=" + inputFile
    print "-output=" + output
    
    for o in args:
        print "args=" + o
    sub1()
    sys.exit()
    


def usage():
    print "in usage"


def showVersion():
    usage()
    print "in showVersion"
	
def sub1():

    file_object = open('1.txt')
    try:
        all_the_text = file_object.read( )
    finally:
        file_object.close( )

    for i in range(1,2):
        for j in range(1,2):
            p = all_the_text
            p = p.replace('#1#',str(i))
            p = p.replace('#2#',str(j))
            p = p.replace('#3#',str(i*10+j))
#            print p

if __name__ == "__main__":
    main()
